package day20171221;

import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ZuoYE {
    public static void main(String[] args) {
        String path1="F:\\信本一班作业";
        String path2="F:\\作业.txt";
        String path3="F:\\未交作业.txt";
        BufferedReader bufferedReader=null;
        BufferedWriter bufferedWriter=null;
        try {
            bufferedReader = new BufferedReader(new FileReader(path2));
            bufferedWriter = new BufferedWriter(new FileWriter(path3));
            File file = new File(path1);
            file.listFiles();
            String str = null;
            String tem = null;
         while ((str = bufferedReader.readLine()) != null) {
             /*step: for (File file1 : file.listFiles()) {
                   // System.out.println(file1);
                    Matcher matcher = Pattern.compile("1班(\\d+.*)作业").matcher("" +
                            "面向对象程序设计Java2016级信本1班1606101007邱义成作业1.docx");
                    while (matcher.find()) {
                        tem = matcher.group(1);
                       // System.out.println(matcher.group(1));
                    }
                    if (str==tem){
                        break step;
                    }
                }*/
             System.out.println(str);
                bufferedWriter.write(str);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                bufferedReader.close();
                bufferedWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
